from mydemo.model import model
stu=model("zh")#实例化
while True:
	print("="*20,"德意志银行","="*20)
	print("欢迎使用德意志银行自助ATM存取款机")
	print("="*52)
    #输入账号以及密码
	a=input("请登录账户:")
	b=input("请输入密码:")
	k=0
	for i in range(int(stu.countnum(stu.count()))):
		if int(a)==int(stu.findone(i+1).get('zhanghu')):
			k=1
			if int(b)==int(stu.findone(i+1).get('mima')):
				print("{0:2}{1:5}{2:2}{3:3}{4:2}{5:3}{6:2}{7:4}".format("1","查询余额","2","取钱","3","存钱","4","退出登录"))
				while True:
					c=input("请输入操作代码：")
					if c=="1":
						print("{0:<4}".format("账户"))
						print("{:<20}".format(stu.findone(i+1).get('zhanghu')))
						print("{:<5}".format('账号余额'))
						print("{:<20}".format(stu.findone(i+1).get('yue')))
					elif c=="2":
						d=int(input("请输入要取出的钱的数目:"))
						e=int(stu.findone(i+1).get('yue'))
						stu.update({'id':i+1,'yue':e-d})
						print("{:<5}".format('账号余额'))
						print("{:<20}".format(stu.findone(i+1).get('yue')))
					elif c=="3":
						f=int(input("请输入要存入的钱的数目:"))
						g=int(stu.findone(i+1).get('yue'))
						stu.update({'id':i+1,'yue':f+g})
						print("{:<5}".format('账号余额'))
						print("{:<20}".format(stu.findone(i+1).get('yue')))
					elif c=="4":
						print("再见沙雕")
						break
					else:
						print("不存在该代码!")
						break
			else:
				print("该账户名密码错误!")
				break
		else:
			if k==0:
				print("该账户不存在")
				break
			else:
				break